#include "ElementManager.h"
#include "Element.h"
#include <math.h>

namespace Core
{
	namespace GameLogic
	{
	
		ElementManager::ElementManager(const Size& mapSize)
			:m_mapSize(mapSize)
		{
			
		}
		void ElementManager::AddElement(Element* element)
		{
			const Position& p=element->GetPosition();
			blocks.insert(make_pair(p,element));
		}

		list<Element*> ElementManager::GetElement(const Position& position)
		{
			list<Element*> k;
			stdext::hash_multimap<Position,Element*>::_Pairii p=blocks.equal_range(position);
			for(stdext::hash_multimap<Position,Element*>::iterator i=p.first;i!=p.second;i++)
			{
				k.push_back(i->second);
			}

			return k;

		}		
	}
}